import Vue from "vue";
export default {
  functional: true,//没有this 实列
  render(h, context) {//h 创建组件 ,所传的属性
    let { parent, data } = context
    let route = parent.$route
    data.routerView = true
    let depath = 0
    // 查找父亲 寻找层级
    while (parent) {
      if (parent.$vnode && parent.$vnode.data.routerView) {
        depath++
      }
      parent = parent.$parent
    }
    let recode = route.metched[depath]
    if (!recode) {
      return h()// 空
    }
    return h(recode.component, data); //jsx
  },
};
